/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						        resource_file.cpp

	$Header: /game/resource_file.cpp $

	$NoKeywords: $

 ************************************************************************/
// resource_file.cpp: implementation of the t_resource_file class.
//
//////////////////////////////////////////////////////////////////////

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "resource_file.h"

#include "compressed_buffer.h"
#include "shared_file.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

// ------------------------------------------------------------------------------
// an aggregate file containing several resources in compressed form
// ------------------------------------------------------------------------------
t_resource_file::t_resource_file( t_shared_file_ptr file )
               : m_file( file )
{
}

t_resource_file::~t_resource_file()
{
}

t_streambuf_ptr t_resource_file::get_stream( int offset )
{
	t_streambuf_ptr stream( new t_shared_file_buffer( m_file ) );

	stream->pubseekpos( offset );
	return t_streambuf_ptr(new t_inflate_buffer( stream ));
}

std::string t_resource_file::get_filename()
{
	if (m_file.get() ==0)
		return std::string("");

	return 	m_file->get_filename();
}
